@use 'sass:list';

.dashboard {
  max-height: 100vh;
  overflow-y: hidden;

  .module-wrap {
    padding: 2vh 2.2vh;
  }

  .login_info {
    padding: 1.2vh 2vh;
  }

  .title-wrap {
    font-size: 1.5vh;
    color: #fff;

    &.config {
      display: flex;

      .title {
        flex: 1;
        line-height: 10px;
      }

      .option {
        margin-left: 2vh;
        height: 2.2vh;
        line-height: 10px;

        &.tabs {
          span {
            line-height: 2.2vh;
          }
        }
      }
    }

    $img_list: (
      './images/title-1.png' './images/title-2.png' './images/title-3.png'
        './images/title-1.png' './images/title-1.png' './images/title-1.png'
        './images/title-1.png' './images/title-1.png'
    );

    @for $i from 1 through list.length($img_list) {
      &_#{$i} {
        background: url(list.nth($img_list, $i)) no-repeat;
        background-size: 100% 2.2vh;
        background-position: bottom;
        margin-bottom: 2vh;
        padding: 0 0.8vh;

        &.warn {
          background: none;

          .title {
            background: url(list.nth($img_list, $i)) no-repeat;
            background-size: 100% 2.2vh;
            background-position: bottom;
          }
        }
      }
    }

    .tabs {
      font-size: 1.2vh;
      background-color: #0f316b;
      height: fit-content;
      display: flex;

      span {
        padding: 0.1vh 1vh;
        cursor: pointer;

        &.active {
          background: #2060c5;
        }
      }
    }
  }

  .total {
    height: 2vh;
    font-weight: bold;
    font-size: 1.5vh;
    line-height: 2vh;
    text-align: center;
    margin-bottom: 1.2vh;
    background: linear-gradient(
      270deg,
      rgba(77, 160, 255, 0) 0%,
      rgba(77, 160, 255, 0.8) 50%,
      rgba(77, 160, 255, 0) 100%
    );
  }

  .count-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(
      270deg,
      rgba(77, 160, 255, 0) 0%,
      rgba(77, 160, 255, 0.18) 50%,
      rgba(77, 160, 255, 0) 100%
    );

    .img-wrap {
      width: 3.5vh;
      height: 3.5vh;
      background: url('./images/device.png') no-repeat;
      background-size: cover;
    }

    .count {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      font-size: 1.4vh;

      div:last-child {
        font-size: 1.2vh;
      }

      &:first-of-type {
        position: relative;

        ::after {
          content: ' ';
          position: absolute;
          top: 0;
          bottom: 0;
          right: 0;
          width: 1px;
          background: url('./images/device-line.png') no-repeat;
          background-size: cover;
        }
      }
    }
  }

  .link-wrap {
    display: flex;
    justify-content: space-between;
    padding: 1vh 1.5vh;
    margin-bottom: 1.5vh;
    font-size: 1.5vh;
    background: linear-gradient(
      90deg,
      rgba(55, 117, 198, 0.6) 0%,
      rgba(55, 117, 198, 0) 100%
    );
  }

  .list_msg {
    padding: 1.2vh;

    .ranking {
      padding: 3px 6px;
      width: fit-content;
      background-color: #4a6b8e;

      &.red {
        background: #ff7979;
      }
    }

    .redText {
      color: #ff7979;
    }
  }

  .earthquake_info {
    max-height: calc(100% - 8vh);

    overflow-y: auto;
  }

  .dashboard_main {
    display: flex;
    flex-direction: column;

    .top {
      flex: 1;
      display: flex;
      flex-direction: column;

      .notice_bottom {
        flex: 1;
      }
    }

    .bottom {
      flex: 3;
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      grid-template-rows: repeat(2, 1fr);
    }
  }

  .notice {
    background-color: #133d63;
    height: fit-content;
    margin: 0 2.2vh 0 0;
    padding: 0.5vh 2.2vh;
    font-size: 1.5vh;
    display: flex;

    .icon {
      margin-right: 1.2vh;
    }
  }

  .data_info {
    display: flex;
    height: calc(100% - 4.5vh);
    padding: 3vh 0;
    $img_list: (
      './images/icon_1.png' './images/icon_2.png' './images/icon_3.png'
        './images/icon_4.png'
    );

    @for $i from 1 through list.length($img_list) {
      .item_#{$i} {
        flex: 1;
        display: flex;
        padding: 0 4vh;
        position: relative;
        justify-content: space-between;
        align-items: center;

        @if $i < 4 {
          &::after {
            position: absolute;
            right: 0;
            top: 50%;
            transform: translateY(-50%);
            content: '';
            display: block;
            min-width: 1.7px;
            height: 8vh;
            background: linear-gradient(
              to bottom,
              rgba(255, 255, 255, 0.1),
              rgba(255, 255, 255, 0.2),
              rgba(255, 255, 255, 0.5),
              rgba(255, 255, 255, 0.9),
              rgba(255, 255, 255, 0.5),
              rgba(255, 255, 255, 0.2),
              rgba(255, 255, 255, 0.1)
            );
            opacity: 0.5;
          }
        }

        .info {
          // align-self: flex-end;
          font-size: 1.5vh;
          display: flex;
          flex-direction: column;
          align-items: center;

          div {
            &:first-child {
              font-size: 2.5vh;
              font-weight: 700;
            }
          }
        }

        .icon {
          width: 7vh;
          height: 7vh;
          // align-self: flex-start;
          background: url(list.nth($img_list, $i)) no-repeat center;
          background-size: cover;
        }
      }
    }
  }

  #chart {
    height: calc(100% - 5vh);
    // background-color: rgba(0, 0, 0, 0.1);
  }
}
